$(function () {

    $("[name='shippingAddressRequired']").on('change',function () {
        $("[name='extra']").remove();

        if($("[name='shippingAddressRequired']").prop("checked") ){
            $("[name='extraF']").append("<div name=\"extra\"> </div>");

            $("[name='extra']").append("\t<table>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<th colspan=2>Shipping Address</th>\n" +
                "\t\t</tr>\n" +
                "\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>First name:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" name=\"order.shipToFirstName\"value=\"ABC\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>Last name:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" name=\"order.shipToLastName\"value=\"XYX\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>Address 1:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" size=\"40\" name=\"order.shipAddress1\"value=\"901 San Antonio Road\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>Address 2:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" size=\"40\" name=\"order.shipAddress2\"value=\"MS UCUP02-206\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>City:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" name=\"order.shipCity\"value=\"Palo Alto\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>State:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" name=\"order.shipState\"value=\"CA\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>Zip:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" size=\"10\" name=\"order.shipZip\"value=\"94303\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\t\t<tr>\n" +
                "\t\t\t<td>Country:</td>\n" +
                "\t\t\t<td>\n" +
                "\t\t\t\t<input type=\"text\" size=\"15\" name=\"order.shipCountry\"value=\"USA\">\n" +
                "\t\t\t</td>\n" +
                "\t\t</tr>\n" +
                "\n" +
                "\n" +
                "\t</table>");
        }
    })

    // $("[name='newOrder']").on('click',function () {
    //
    //     var ordercardType = $("[name='order.cardType']").val();
    //     var ordercreditCard = $("[name='order.creditCard']").val();
    //     var orderexpiryDate = $("[name='order.expiryDate']").val();
    //     var orderbillToFirstName = $("[name='order.billToFirstName']").val();
    //     var orderbillToLastName = $("[name='order.billToLastName']").val();
    //     var orderbillAddress1 = $("[name='order.billAddress1']").val();
    //     var orderbillAddress2 = $("[name='order.billAddress2']").val();
    //     var orderbillCity = $("[name='order.billCity']").val();
    //     var orderbillState = $("[name='order.billState']").val();
    //     var orderbillZip = $("[name='order.billZip']").val();
    //     var orderbillCountry = $("[name='order.billCountry']").val();
    //
    //     var ordershipToFirstName = $("[name='order.shipToFirstName']").val();
    //     var ordershipToLastName = $("[name='order.shipToLastName']").val();
    //     var ordershipAddress1 = $("[name='order.shipAddress1']").val();
    //     var ordershipAddress2 = $("[name='order.shipAddress2']").val();
    //     var ordershipCity = $("[name='order.shipCity']").val();
    //     var ordershipState = $("[name='order.shipState']").val();
    //     var ordershipZip = $("[name='order.shipZip']").val();
    //     var ordershipCountry = $("[name='order.shipCountry']").val();
    //
    //     $("[name='newForm']").remove();
    //     $("[name='allForm']").append("\t<div name=\"newForm\" id=\"Catalog\"></div>");
    //
    //     $("[name='newForm']").append("    <table align=\"center\">\n" +
    //         "        <tr>\n" +
    //         "        <th align=\"center\" colspan=\"2\"><font size=\"4\"><b>Order</b></font>\n" +
    //         "        <br />");
    //
    //     $("[name='newForm']").append("<font size=\"3\"><b> <fmt:formatDate\n" +
    //         "        value=" + orderexpiryDate + " pattern=\"yyyy/MM/dd hh:mm:ss\" /></b></font>");
    //
    //     $("[name='newForm']").append("       </th>\n" +
    //         "        </tr>\n" +
    //         "\n" +
    //         "        <tr align=\"center\">\n" +
    //         "        <th align=\"center\" colspan=\"2\">Billing Address</th>\n" +
    //         "        </tr>\n" +
    //         "        <tr>\n" +
    //         "        <td align=\"center\">First name:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillToFirstName + "</td>");
    //
    //     $("[name='newForm']").append("            </tr>\n" +
    //         "            <tr align=\"center\">\n" +
    //         "            <td align=\"center\">Last name:</td>")
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillToLastName + "</td>");
    //
    //     $("[name='newForm']").append("           </tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Address 1:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillAddress1 + "</td>");
    //
    //     $("[name='newForm']").append("            </tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Address 2:</td>")
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillAddress2 + "</td>")
    //
    //     $("[name='newForm']").append("            </tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">City:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillCity + "</td>");
    //
    //     $("[name='newForm']").append("            </tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">State:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillState + "</td>");
    //
    //     $("[name='newForm']").append("            </tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Zip:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillZip + "</td>");
    //
    //     $("[name='newForm']").append("            </tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Country:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + orderbillCountry + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <th align=\"center\" colspan=\"2\">Shipping Address</th>\n" +
    //         "        </tr>\n" +
    //         "        <tr>\n" +
    //         "        <td align=\"center\">First name:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipToFirstName + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Last name:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipToLastName + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Address 1:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipAddress1 + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Address 2:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipAddress2 + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">City:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipCity + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">State:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipState + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Zip:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipZip + "</td>");
    //
    //     $("[name='newForm']").append("</tr>\n" +
    //         "            <tr>\n" +
    //         "            <td align=\"center\">Country:</td>");
    //
    //     $("[name='newForm']").append("<td align=\"center\">" + ordershipCountry + "</td>");
    //
    //     $("[name='newForm']").append("\n" +
    //         "            </tr>\n" +
    //         "\n" +
    //         "            </table>")
    //
    //     $("[name='newForm']").append("<a href=\"ViewOrder\" class=\"Button\" name=\"confirmed\">Confirm</a>")
    //
    // })
    
    
})